' Estimated using Eviews 7 or 8.
' Estimation code for model A with m_01 = m_02 = 0, and m_03 = 1
' Likelihood optimized using Marquardt optimization
' Note that compared to the results in the paper, these estimates are based on promotional dummies instead of (proprietary) promotional costs.
' As a consequence of this, the promotional effects and the day of the week effects are not well identified (due to collinearity).
' Note that starting values are important and that to obtain the maximum likelihood one needs to experiment with different starting values


' declare coefficient vectors
@param cc(1) 1000 cc(2) 1000 cc(3) 2000 cc(4) 1000 cc(5) .8 cc(6) .4 cc(7) .41 cc(8) -.2 cc(9) -.2 cc(10) -.0  cc(12) 0 cc(13) .1 cc(14) .1 cc(15) 5000 cc(16) 4000 cc(17) 16000 cc(18) 19000 cc(19) -2000 cc(20) -1000 cc(21) 0 cc(22) -1000 cc(23) 4000 cc(24) 6000 cc(25) 3000 cc(26) 30 cc(27) 2000 cc(29) 1000 cc(30) 1000 cc(31) 1001 cc(32) .001 cc(40) 10 cc(41) 1000 cc(42) 1000 cc(50) 10 cc(60) 1000  cc(70) -1 cc(80) -.1 cc(81) -.1 cc(82) -.1 c(11) 2500

Xb 	=  cc(1) + cc(2) * prom_entertainment - cc(2) * (cc(6) +cc(7)) * prom_entertainment(-1) + cc(2) * cc(6) * cc(7) * prom_entertainment(-2) + cc(3) * prom_giveaway - cc(3) * (cc(5) +cc(7)) * prom_giveaway(-1) + cc(3) * cc(5) * cc(7) * prom_giveaway(-2) + cc(4) * prom_kids - cc(4) * (cc(5) +cc(6)) * prom_kids(-1) + cc(4) * cc(5) * cc(6) * prom_kids(-2) +	( cc(5) + cc(6) + cc(7) ) * attendance(-1) - ( cc(5) * cc(6) + cc(5) * cc(7) + cc(6) * cc(7) ) * attendance(-2) + ( cc(5) * cc(6) * cc(7) ) * attendance(-3)  + ( cc(12) - cc(7) * cc(4) ) * prom_kids(-1) - ( cc(5) + cc(6) ) * ( cc(12) - cc(7) * cc(4) ) * prom_kids(-2) + cc(5) * cc(6) * ( cc(12) - cc(7) * cc(4) ) * prom_kids(-3) + cc(15) * Season11 + cc(16) * season12 + cc(17) * opening11 + cc(18) * opening12 + cc(23) * day5 + cc(24) * day6 + cc(27) * day7 + cc(28) * july + cc(29) * august + cc(30) * sep + cc(31) * perf_wp + cc(32) * opp_distance + cc(50) * temp +  cc(60) * nattv + cc(80) * Control_entertainment + cc(81) * control_giveaway + cc(82) * control_kids - (cc(5) + cc(6) + cc(7)) * ( cc(15) * Season11(-1) + cc(16) * season12(-1) + cc(17) * opening11(-1) + cc(18) * opening12(-1) + cc(23) * day5(-1) + cc(24) * day6(-1) + cc(27) * day7(-1) + cc(28) * july(-1) + cc(29) * august(-1) + cc(30) * sep(-1) + cc(31) * perf_wp(-1) + cc(32) * opp_distance(-1) + cc(50) * temp(-1) + cc(60) * nattv(-1) + cc(80) * Control_entertainment(-1) + cc(81) * control_giveaway(-1) + cc(82) * control_kids(-1) ) + ( cc(5) * cc(6) + cc(5) * cc(7) + cc(6) * cc(7) ) * ( cc(15) * Season11(-2) + cc(16) * season12(-2) + cc(17) * opening11(-2) + cc(18) * opening12(-2) + cc(23) * day5(-2) + cc(24) * day6(-2) + cc(27) * day7(-2) + cc(28) * july(-2) + cc(29) * august(-2) + cc(30) * sep(-2) + cc(31) * perf_wp(-2) + cc(32) * opp_distance(-2) + cc(50) * temp(-2) + cc(60) * nattv(-2) + cc(80) * Control_entertainment(-2) + cc(81) * control_giveaway(-2) + cc(82) * control_kids(-2) ) - ( cc(5) * cc(6) * cc(7) ) * ( cc(15) * Season11(-3) + cc(16) * season12(-3) + cc(17) * opening11(-3) + cc(18) * opening12(-3) + cc(23) * day5(-3) + cc(24) * day6(-3) + cc(27) * day7(-3) + cc(28) * july(-3) + cc(29) * august(-3) + cc(30) * sep(-3) + cc(31) * perf_wp(-3)  + cc(32) * opp_distance(-3) + cc(50) * temp(-3) +  cc(60) * nattv(-3) + cc(80) * Control_entertainment(-3) + cc(81) * control_giveaway(-3) + cc(82) * control_kids(-3))

res	= Attendance - Xb
resma	= res + ( cc(5) + cc(6) + cc(7) ) * resma(-1) - ( cc(5) * cc(6) + cc(5) * cc(7) + cc(6) * cc(7) ) * resma(-2) + ( cc(5) * cc(6) * cc(7) ) * resma(-3) 
stddev	= cc(11)


logl1	= log(@dnorm(resma/stddev)) - log(stddev^2)/2

@logl logl1






